<ui:composition xmlns:p='http://primefaces.org/ui'
                xmlns:h='http://java.sun.com/jsf/html'
                xmlns:ui='http://java.sun.com/jsf/facelets'>

<p:toolbar styleClass='toolBar'>

<p:toolbarGroup style='width:100%'>

  <p:commandButton icon='ui-icon-new'  title='Nuevo'   actionListener='#{bean.uiClean}'  update='@(.#{bean.name})' style='width:70px;border: none' />

  <p:commandButton icon='ui-icon-save' title='Guardar' actionListener='#{bean.uiMerge}'  update='@(.#{bean.name})' style='width:70px;border: none' rendered='#{bean.form}' process='@this #{bean.name}Form #{process}'/>

  <p:commandButton icon='ui-icon-gear' title='Editor'  actionListener='#{bean.uiDialog}' update='@(.#{bean.name})' style='width:70px;border: none' rendered='#{!bean.form}'/>

  <p:commandButton icon='ui-icon-find' title='Buscar'  actionListener='#{bean.uiFind}'   update='@(.#{bean.name})' style='width:70px;float:right;border: none' rendered='#{bean.form}'/>

  <p:commandButton icon='ui-icon-del'  title='Borrar'  actionListener='#{bean.uiRemove}' update='@(.#{bean.name})' style='width:70px;float:right;border: none' rendered='#{not empty bean.lsEntity and !bean.form}'/>

</p:toolbarGroup>

</p:toolbar>


<p:dataTable value='#{bean.lsEntity}' var='x' paginator='true' paginatorPosition='bottom' rows='#{rows== null? 15 : rows}' rowKey='#{x.id}'  emptyMessage='' rowStyleClass='#{rowStyleClass}'

             paginatorAlwaysVisible='false' selectionMode='multiple' selection='#{bean.selEntity}' filteredValue='#{bean.lsFiltered}'>

  <p:ajax event='rowSelect' update='@(.#{bean.name})'/>


  <p:column style='width:18px' rendered='#{not empty bean.lsEntity}'>

  <p:commandButton icon='ui-icon-edit' title='Editar' actionListener='#{bean.uiEdit}'  update='@(.#{bean.name})'

  style='width:18px;height:18px;border:none;float:right;background:transparent' rendered='#{x.id == bean.selEntity[0].id}'/>

  </p:column>


  <p:column headerText='Codigo' filterBy='#{x.id}' sortBy='#{x.id}' filterStyleClass='columnFind' style='width:55px;height:20px'>

  <h:outputText value='#{x.id}'     rendered='#{!bean.entityHasCode}'/>

  <h:outputText value='#{x.codigo}' rendered='#{bean.entityHasCode}'/>

  </p:column>

  <ui:insert/>

</p:dataTable>

</ui:composition>